package com.panda.pandawash.activity;

import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.panda.pandawash.R;
import com.panda.pandawash.view.StatusBarCompat;

import org.xutils.view.annotation.ContentView;
import org.xutils.x;


@ContentView(R.layout.activity_lockfast)
public class LockFastActivity extends AppCompatActivity {
//    @ViewInject(R.id.login_button)
    ImageView skipButton;
//    TextView skipText;
    private static final int skipButtonSizeInDip = 92;
    private static final int skipButtonSizeVerInDip = 78;
    private static final int skipButtonMargTopinInDip = 38;
    private static final int skipButtonMarginRightInDip = 18;
    private Integer duration = 6;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_lockfast);
        x.view().inject(this);
        if(Build.VERSION.SDK_INT>= Build.VERSION_CODES.KITKAT) {
            StatusBarCompat.compat(this, getResources().getColor(R.color.colorPrimary));
        }
        LinearLayout btn = (LinearLayout) this.findViewById(R.id.login_button);
        skipButton = new ImageView(this);
//        skipText = new TextView(this);
        int skipButtonHorSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, skipButtonSizeInDip, this.getResources().getDisplayMetrics());
        int skipButtonVerSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, skipButtonSizeVerInDip, this.getResources().getDisplayMetrics());
        Log.e("hys11111","skipButtonHorSize=== "+skipButtonHorSize+"skipButtonVerSize === "+skipButtonVerSize);
        FrameLayout.LayoutParams skipButtonLayoutParams = new FrameLayout.LayoutParams(skipButtonHorSize, skipButtonVerSize);
        skipButtonLayoutParams.gravity = Gravity.TOP|Gravity.RIGHT;
        int skipButtonMarginTop = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, skipButtonMargTopinInDip, this.getResources().getDisplayMetrics());
        int skipButtonMarginRight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, skipButtonMarginRightInDip, this.getResources().getDisplayMetrics());

        skipButtonLayoutParams.setMargins(0, skipButtonMarginTop, skipButtonMarginRight, 0);
        skipButton.setScaleType(ImageView.ScaleType.CENTER);
        skipButton.setImageResource(R.drawable.ic_skip_btn);

        btn.addView(skipButton, skipButtonLayoutParams);
    }

}
